package com.example.studyflow.thread;

/**
 * @Author: hanll
 * @ClassName: ThreadOrder
 * @Date: 2022-10-26 15:36
 * @Version: 1.0
 * @Description:
 */
class ThreadOrder {

    public static void main(String[] args) throws InterruptedException {
        ThreadRunnable threadRunnable = new ThreadRunnable();
        Thread thread = new Thread(threadRunnable,"线程A");
        Thread thread2 = new Thread(threadRunnable,"线程B");
        thread.start();
        thread.join();
        thread2.start();
        thread2.join();
    }
}
class ThreadRunnable implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+":" + i);
        }
    }
}
